#Path of Project root
PILO_PROJECT_DIR := $(shell pwd)
PILO_DIR := $(shell dirname $(PILO_PROJECT_DIR))

#Arch of Current system
ifeq ($(shell getconf LONG_BIT), 64)
    ARCH = x64
    PLATFORM_NAME = x86_64
    PLATFORM_DEF = -D__x64__ -D__x86_64__
else
    ARCH = x86	
    PLATFORM_NAME = i386
    PLATFORM_DEF = -D__i386__	
endif

#Tools
ifdef USE_NATIVE_CC
	CC := g++
	LD := g++
else
	CC := $(PILO_PROJECT_DIR)/tools/gcc-4.1.2/$(PLATFORM_NAME)/bin/g++
	LD := $(PILO_PROJECT_DIR)/tools/gcc-4.1.2/$(PLATFORM_NAME)/bin/g++
endif

AR := ar
RM := rm
CP := cp
MKDIR := mkdir
INSTALL := install

CFLAGS :=
LDFLAGS :=
DEFINES := $(PLATFORM_DEF)

ifdef RELEASE
     CONF_NAME=Release
     CFLAGS += -ggdb -O2
     LDFLAGS += -O2
else
     CONF_NAME=Debug
     CFLAGS += -ggdb
     DEFINES += -D_DEBUG
endif

ifeq ($(ARCH) , x64)
    CFLAGS += -m64
else
endif

CFLAGS += -c -pthread -Wall -Werror
CPPFLAGS += -c -pthread -Wall -Werror
LDFLAGS +=
SYS_INC_PATH := /usr/include
SYS_LIBS := -lpthread -luuid

INCLUDES := -I$(SYS_INC_PATH) -I$(PILO_DIR)/core
CPPFLAGS += $(INCLUDES)
CPPFLAGS += $(DEFINES)

OUTPUT_DIR := $(PILO_DIR)/output
OUTPUT_LIB_DIR := $(OUTPUT_DIR)/lib
OUTPUT_INC_DIR := $(OUTPUT_DIR)/include

